﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace fApp.Forms
{
    public partial class fMBox : fForm
    {
        DialogResult rResult = DialogResult.OK;
        DialogResult lResult = DialogResult.Cancel;
        public fMBox()
        {
            InitializeComponent();
        }

        public DialogResult Show(string message,string lButton,string rButton,bool is2Button,DialogResult left,DialogResult right)
        {
            rResult = right;
            lResult = left;
            //２ボタン使うか
            if (is2Button)
            {
                this.Message.Text = message;
                this.eButton1.eText = lButton;
                this.eButton2.eText = rButton;
                return this.ShowDialog();
            }
            //使わない場合、左ボタンをセンタリング
            else
            {
                this.Message.Text = message;
                this.eButton1.eText = lButton;
                this.eButton2.Dispose();
                this.eButton1.Location= new Point( this.Width / 2 - 40,this.eButton2.Location.Y);
                return this.ShowDialog();
            }
        }

        private void eButton1_Load(object sender, EventArgs e)
        {

        }

        private void eButton1_Click(object sender, EventArgs e)
        {
            this.DialogResult = lResult;
            this.Close();
        }

        private void eButton2_Click(object sender, EventArgs e)
        {
            this.DialogResult = rResult;
            this.Close();
        }
    }
}
